<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.yaodian100.core.common.utils.ServerValue" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ include file="/taglibs.jsp" %>

<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>' />

<script language="javascript">
	function exporting(amountId){
		if(confirm("是否确定汇出?")){
			$("#aFlaga"+amountId).attr("style","display:none;");
			$("#aFlagb"+amountId).attr("style","");
			window.location.href="${midContextPath}/giftcard/export.do?amountId="+amountId;
		}
	}
	
	function warehouse(amountId){
		if(confirm("是否确定入库?")){
			window.location.href="${midContextPath}/giftcard/warehouse.do?amountId="+amountId;
		}
	}
	
	function cancel(amountId){
		if(confirm("一经作废将无法还原，是否确定作废?")){
			window.location.href="${midContextPath}/giftcard/cancel.do?amountId="+amountId;
		}
	}
</script>

<h1>礼品卡管理 - 检视面额</h1>

<s:if test="hasActionErrors()">
	<s:actionerror cssClass="msg rn"/><p />
</s:if>
<s:if test="hasActionMessages()">
	<s:actionmessage cssClass="msg rn"/><p />
</s:if>
<s:if test="hasFieldErrors()">
	<s:fielderror cssClass="msg rn"/><p />
</s:if>

<div class="f-link">
	<a href="${midContextPath}/giftcard/list.do">回礼品卡查询</a>
</div>
<br />
<br />
&nbsp;
<table class="tb-data" width="100%">
	<tr>
		<th width="25%">礼品卡批号</th>
		<td>
			${giftcardMain.mainId}
		</td>
	</tr>
	<tr>
		<th>礼品卡名称</th>
		<td>
			${giftcardMain.giftcardName}
		</td>
	</tr>
	<tr>
		<th>充值期限</th>
		<td>
			<fmt:formatDate value="${giftcardMain.rechargeDeadline}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
	<tr>
		<th>申请人</th>
		<td>
			${giftcardMain.applyUser}
		</td>
	</tr>
	<tr>
		<th>申请日期</th>
		<td>
			<fmt:formatDate value="${giftcardMain.applyDate}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
	<tr>
		<th>建立人</th>
		<td>
			${giftcardMain.createUser}
		</td>
	</tr>
	<tr>
		<th>建立时间</th>
		<td>
			<fmt:formatDate value="${giftcardMain.createDate}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
	<tr>
		<th>修改人</th>
		<td>
			${giftcardMain.modifyUser}
		</td>
	</tr>
	<tr>
		<th>修改时间</th>
		<td>
			<fmt:formatDate value="${giftcardMain.modifyDate}" pattern="yyyy-MM-dd HH:mm:ss" />
		</td>
	</tr>
</table>

<br />
<br />
<br />
<s:form method="post" id="viewAmountForm">	
	<table width="100%">
		<thead class="tb-1">
			<tr>
				<th width="15%">面额</th>
				<th width="15%">数量</th>
				<th width="25%">小计</th>
				<th width="15%">状态</th>
				<th width="30%">功能</th>
			</tr>
		</thead>
		<tbody class="tb-1">
			<c:forEach items="${giftcardAmounts}" var="giftcardAmount" varStatus="rows_index">
				<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
					<td>${giftcardAmount.amount}</td>
					<td>${giftcardAmount.count}</td>
					<td>${giftcardAmount.amount*giftcardAmount.count}</td>
					<td>${giftcardQueryStatusMenu.options[giftcardAmount.status].name}</td>
					<td>
					<c-rt:if test="${giftcardAmount.status=='00'}">
						<a href="javascript:exporting(${giftcardAmount.amountId});" id="aFlaga${giftcardAmount.amountId}">汇出</a>
						<a href="javascript:warehouse(${giftcardAmount.amountId});" style="display:none;" id="aFlagb${giftcardAmount.amountId}">入库</a>
						<a href="javascript:cancel(${giftcardAmount.amountId});">作废</a>
					</c-rt:if>
					<c-rt:if test="${giftcardAmount.status=='10'}">
						<a href="javascript:warehouse(${giftcardAmount.amountId});">入库</a>
						<a href="javascript:cancel(${giftcardAmount.amountId});">作废</a>
					</c-rt:if>
						<a href="${midContextPath}/giftcard/viewItem.do?amountId=${giftcardAmount.amountId}">卡号明细</a>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</s:form>
<br />